/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.tomasio.projects.welcome;

import com.tomasio.projects.welcome.dao.CameraDAO;
import com.tomasio.projects.welcome.dao.DAOFactory;
import com.tomasio.projects.welcome.dto.CameraDTO;
import com.tomasio.projects.welcome.interfaces.CamerasService;
import com.tomasio.projects.welcome.util.DAOUtil;
import java.util.List;

/**
 *
 * @author administrador
 */
public class SimpleCamerasService implements CamerasService {

    private DAOFactory factory = DAOUtil.getDAOFactory();

    @Override
    public void createCamera(CameraDTO camera) {
        CameraDAO dao = factory.getCameraDAO();
        dao.create(camera);
    }

    @Override
    public void removeCamera(Long cameraId) {
        CameraDAO dao = factory.getCameraDAO();
        dao.remove(cameraId);
    }

    @Override
    public CameraDTO findCamera(Long cameraId) {
        CameraDAO dao = factory.getCameraDAO();
        return dao.find(cameraId);
    }

 

    @Override
    public List<CameraDTO> findAllCameras() {
        CameraDAO dao = factory.getCameraDAO();
        return dao.findAll();
    }

    @Override
    public void updateCamera(CameraDTO camera) {
        CameraDAO dao = factory.getCameraDAO();
        dao.update(camera);
    }
}
